home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 3.3 KB | 111 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWPat.h
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWPAT_H
- #define FWPAT_H
-
- #ifndef FWPRIMEM_H
- #include "FWPriMem.h"
- #endif
-
- #ifndef FWSTREAM_H
- #include "FWStream.h"
- #endif
-
- // ----- Quickdraw Includes -----
-
- #if defined(FW_BUILD_MAC) && !defined(__QUICKDRAW__)
- #include <QuickDraw.h>
- #endif
-
- //==============================================================================
- // •• Standard Patterns (should be moved somewhere else)
- //==============================================================================
-
- const char FW_kBlackPat[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
- const char FW_kWhitePat[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-
- const char FW_kGrayPat[8] = {0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA};
- const char FW_kLightGrayPat[8] = {0xEE, 0x44, 0xEE, 0x44, 0xEE, 0x44, 0xEE, 0x44};
- const char FW_kDarkGrayPat[8] = {0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD};
-
- const char FW_kHorizontalPat[8] = {0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00};
- const char FW_kVerticalPat[8] = {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11};
- const char FW_kFDiagonalPat[8] = {0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11};
- const char FW_kBDiagonalPat[8] = {0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88};
- const char FW_kCrossPat[8] = {0x88, 0x88, 0x88, 0xFF, 0x88, 0x88, 0x88, 0xFF};
- const char FW_kDiagCrossPat[8] = {0x88, 0x55, 0x22, 0x55, 0x88, 0x55, 0x22, 0x55};
-
- const char FW_kAntPat[8] = {0xCC, 0x66, 0x33, 0x99, 0xCC, 0x66, 0x33, 0x99};
-
- //==============================================================================
- // •• CLASS FW_CPattern
- //==============================================================================
-
- class FW_CPattern
- {
- //------------------------------------------------------------------------------
- // • Constructors/Destructors
- //
- public:
- FW_CPattern();
- FW_CPattern(const char* pattern);
- FW_CPattern(const FW_CPattern& otherPattern);
-
- //------------------------------------------------------------------------------
- // • New API
- //
- public:
- #ifdef FW_BUILD_MAC
- operator const Pattern*() const
- {return (Pattern*)&fPattern;}
- operator const Pattern&() const
- {return *((Pattern*)&fPattern);}
- #endif
-
- operator const char*() const
- {return fPattern;}
-
- FW_CPattern& operator=(const FW_CPattern& otherPattern);
- FW_CPattern& operator=(const char* otherPattern);
-
- char& operator[](short index)
- {return fPattern[index];}
- char operator[](short index) const
- {return fPattern[index];}
-
- void Invert();
-
- void FlipHorizontaly();
- void FlipVerticaly();
-
- void ShiftUp();
- void ShiftDown();
- void ShiftLeft();
- void ShiftRight();
-
- void Flatten(FW_CWritableStream& stream)
- {stream.Write(fPattern, 8);}
- void Unflatten(FW_CReadableStream& stream)
- {stream.Read(fPattern, 8);}
-
- private:
- void MovePattern(const char* source, char* destination)
- {FW_PrimitiveCopyMemory(source, destination, 8);}
-
- //------------------------------------------------------------------------------
- // • Data Member
- //
- private:
- char fPattern[8]; // OPF convention 1:foreground 0:background
- };
-
- #endif